﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using DTO;
namespace GiaoDien
{
    public partial class FormLoaiDocGia : Form
    {
        private DataTable datatable;
        private string sqlquery;
        public FormLoaiDocGia()
        {
            InitializeComponent();
        }

        void init()
        {
            datatable = new DataTable();
            sqlquery = "";
        }

        void xemtatca()
        {
            LOAIDOCGIABUS ldgBUS = new LOAIDOCGIABUS();
            datatable = ldgBUS.Loadloaidocgia();
            this.dataGridView1.DataSource = datatable;
        }

        private void FORMLoaiDocGia_Load(object sender, EventArgs e)
        {
            init();
            xemtatca();
        }

        private void btnxemtatca_Click(object sender, EventArgs e)
        {
            xemtatca();
        }

        private void btnlapthe_Click(object sender, EventArgs e)
        {

        }

        void capnhat()
        {
            LOAIDOCGIABUS ldgBUS = new LOAIDOCGIABUS();
            sqlquery = "SELECT * FROM LOAI_DOC_GIA";
            int kq = ldgBUS.update(datatable, sqlquery);
            if (kq > 0)
                MessageBox.Show("Thành công");
            else
                MessageBox.Show("Thất bại");
            xemtatca();
        }

        private void btncapnhat_Click(object sender, EventArgs e)
        {
            capnhat();
        }

        private void btnthoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
